package com.ocom.minio.common.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;


@Lazy
@Configuration
public class BeanConfig {

    @Autowired
    private FileProperties fileProperties;


    @Bean
    public MinioClient minioClient() throws Exception{
//        MinioClient minioClient = new MinioClient(fileProperties.getServerPath(),
//                fileProperties.getAccessKey(), fileProperties.getSecureKey(),fileProperties.getConfigDir());
//        MinioClient minioClient = new MinioClient("http://47.107.69.158",9005,
//                "50KE5L4LJDZL7PFD83FP", "MyoP9YFKzfbfeo4h+LsEmvQJqBG6Mx71Wmyhd9Ak","/data2/minio",false);
        MinioClient minioClient = new MinioClient(fileProperties.getEndpoint(),fileProperties.getAuthPort(),
                fileProperties.getAccessKey(), fileProperties.getSecureKey(),fileProperties.getConfigDir(),false);
        return minioClient;
    }
}
